#include-once
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>

Global $hGUI, $iX, $iY, $iWidth, $sBackground

Func _GUI_MoveFull(ByRef $hGUI, $iMode)
	Local $aWinPos = WinGetPos($hGUI)
	If $iMode = 1 Then
		For $i = -$aWinPos[3] To -$aWinPos[3] / 700 Step 30
			WinMove($hGUI, "", 0, $i)
			Sleep(10)
		Next
		For $i2 = -$aWinPos[3] / 700 To 0 Step 10
			WinMove($hGUI, "", 0, $i2)
			Sleep(10)
		Next
	ElseIf $iMode = 2 Then
		For $i = -$aWinPos[2] To -$aWinPos[2] / 700 Step 30
			WinMove($hGUI, "", $i, 0)
			Sleep(10)
		Next
		For $i2 = -$aWinPos[2] / 700 To 0 Step 10
			WinMove($hGUI, "", $i2, 0)
			Sleep(10)
		Next
	ElseIf $iMode = 3 Then
		For $i = $aWinPos[2] To $aWinPos[2] / 700 Step -30
			WinMove($hGUI, "", $i, 0)
			Sleep(10)
		Next
		For $i2 = $aWinPos[2] / 700 To 0 Step -10
			WinMove($hGUI, "", $i2, 0)
			Sleep(10)
		Next
	ElseIf $iMode = 4 Then
		For $i = $aWinPos[3] To $aWinPos[3] / 700 Step -30
			WinMove($hGUI, "", 0, $i)
			Sleep(10)
		Next
		For $i2 = $aWinPos[3] / 700 To 0 Step -10
			WinMove($hGUI, "", 0, $i2)
			Sleep(10)
		Next
	EndIf
	WinMove($hGUI, "", 0, 0)
EndFunc   ;==>_GUI_MoveFull

Func _GUI_MoveControl(ByRef $hGUI, $iMode)
	Local $aWinPos = WinGetPos($hGUI)
	If $iMode = 1 Then
		For $i = -$aWinPos[3] To $aWinPos[1] Step 30
			WinMove($hGUI, "", $aWinPos[0], $i)
			Sleep(10)
		Next
	ElseIf $iMode = 2 Then
		For $i = -$aWinPos[2] To $aWinPos[0] Step 30
			WinMove($hGUI, "", $i, $aWinPos[1])
			Sleep(10)
		Next
	ElseIf $iMode = 3 Then
		For $i = $aWinPos[2] To $aWinPos[0] Step -30
			WinMove($hGUI, "", $i, $aWinPos[1])
			Sleep(10)
		Next
	ElseIf $iMode = 4 Then
		For $i = @DesktopHeight + $aWinPos[3] To $aWinPos[1] Step -30
			WinMove($hGUI, "", $aWinPos[0], $i)
			Sleep(10)
		Next
	EndIf
	WinMove($hGUI, "", $aWinPos[0], $aWinPos[1])
EndFunc   ;==>_GUI_MoveControl

Func _Load_Init(ByRef $hGUI, $iX, $iY, $iWidth)
	_WinAPI_SetLayeredWindowAttributes($hGUI, 0x000000, 255)
	_WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_ERASE, $RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_FRAME, $RDW_ALLCHILDREN))
	Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
	Local $hGBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, 16, $hGraphics)
	Local $hGBackbuffer = _GDIPlus_ImageGetGraphicsContext($hGBitmap)
	Local $hBrush = _GDIPlus_BrushCreateSolid(0xff6600ff)
	Local $aData[7] = [$hGraphics, $hGBitmap, $hGBackbuffer, $hBrush, $iX, $iY, $iWidth]
	Return $aData
EndFunc   ;==>_Load_Init

Func _Load_SetCirclesNumber($iCirclesNum)
	Global $aCircle[$iCirclesNum][3]
	For $i = $iCirclesNum - 1 To 0 Step -1
		$aCircle[$i][0] = 64 * - $i
		$aCircle[$i][1] = 8
	Next
	Return $aCircle
EndFunc   ;==>_Load_SetCirclesNumber

Func _Load_Start(ByRef $aData, ByRef $aCircle)
	_GDIPlus_GraphicsClear($aData[2])
	For $i = 0 To UBound($aCircle, 1) - 1 Step 1
		_GDIPlus_GraphicsFillEllipse($aData[2], $aCircle[$i][0], $iY, 16, 16, $aData[3])
		$aCircle[$i][0] += $aCircle[$i][1]
		If ($aCircle[$i][0] + 16) > $aData[6] Then $aCircle[$i][0] = $aData[4]
		If $aCircle[$i][0] >= $aData[6] / 4 Then $aCircle[$i][1] = 3
		If $aCircle[$i][0] >= $aData[6] / 4 * 3 Then $aCircle[$i][1] = 8
	Next
	_GDIPlus_GraphicsDrawImageRect($aData[0], $aData[1], $aData[4], $aData[5], $aData[6], 16)
EndFunc   ;==>_Load_Start

Func _Load_Shutdown(ByRef $aData, ByRef $aCircle)
	_GDIPlus_GraphicsDispose($aData[0])
	_GDIPlus_ImageDispose($aData[2])
	_GDIPlus_BitmapDispose($aData[1])
	_GDIPlus_BrushDispose($aData[3])
	$aData = 0
	$aCircle = 0
EndFunc   ;==>_Load_Shutdown
